<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * sitech
 *
 * @package		sitech
 * @author		SITECH : Dev Team - Sokthea Peng
 * @license		http://sitech.com.kh
 * @link		http://sitech.com.kh
 * @since		Version 0.9.4
 */

// ------------------------------------------------------------------------


/**
 * sitech Media Model
 *
 * @package		sitech
 * @subpackage	Models
 * @category	All Models
 * @author		SITECH : Dev Team - Sokthea Peng
 *
 */

class pr_pdf_model extends Base_model 
{
	/**
	 * Constructor
	 *
	 * @access	public
	 */
	public function __construct()
	{
		parent::__construct();

		$this->pk_name	= 	'id';	 
			
	}
	
	/**
	 * PDF invoice head
	 *
	 */
	
	function PDF_invoice_head($posts = FALSE, $orderby = FALSE, $options = FALSE)
	{
		$this->db->select(" * ");
		
		if($posts != FALSE)
			$this->db->where($posts);
			
		if($orderby == FALSE)
			$this->db->order_by('pd_id',$options);
		else
			$this->db->order_by($orderby,$options);
			
		$query = $this->db->get('tbl_product as tbl_product');
//trace($this->db->queries);
		if(!empty($query))
		{	
			$data = array();
			if ( $query->num_rows() > 0 )
				$data = $query->result_array();
			return $data;
		}	
	}
	
	/**
	 * PDF invoice body
	 *
	 */
	
	function PDF_invoice_body($posts = FALSE, $orderby = FALSE, $options = FALSE)
	{
		$this->db->select(" * ");
						
		if($posts != FALSE)
			$this->db->where($posts);
			
		if($orderby == FALSE)
			$this->db->order_by($this->pk_name,$options);
		else
			$this->db->order_by($orderby,$options);
			
		$query = $this->db->get('tbl_product');
		//trace($this->db);
		if(!empty($query))
		{	
			$data = array();
			if ( $query->num_rows() > 0 )
				$data = $query->result_array();
			return $data;
		}	
	}
	/**
	 * Get Data Type of Fileds
	 *
	 */ 	 
	function get_datatype($data)
	{	
		$this->db->select('column_name,data_type');		
		$query = $this->db->get_where('information_schema.columns', $data);

		if(!empty($query))
		{	
			$results = array();
			if ( $query->num_rows() > 0 )
			{
				$results = $query->result_array();
						
				/*foreach($results as $result)
				{
					$datas[$result['column_name']]	= $result['data_type'];
				}*/				
			}
			return $results;
		}
	}

} // End Class
/* End of file invoices_hold_model.php */
/* Location: ./application/models/invoices_hold_model.php */